package com.tczs.server.action;

import com.tczs.server.request.ServerRequestModel;
import com.tczs.server.response.Response;
import io.netty.handler.codec.http.FullHttpResponse;
import org.apache.log4j.Logger;

public class DefaultServerExecute implements ServerExecute{
    private static Logger logger = Logger.getLogger(DefaultServerExecute.class);


    @Override
    public FullHttpResponse execute(ServerRequestModel serverRequestModel) {
        logger.info("entry default execute: "+serverRequestModel.toString());
        if("/hello".equals(serverRequestModel.getUrl())){
            return Response.okResponse("success");
        }else if("/error".equals(serverRequestModel.getUrl())){
            return Response.errorResponse();
        }else{
            return Response.notFoundResponse();
        }
    }
}
